<?php
/* @var $this \yii\web\View */
/* @var $content string */

use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
    <head>
        <meta charset="<?= Yii::$app->charset ?>">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <?= Html::csrfMetaTags() ?>
        <title><?= Html::encode($this->title) ?></title>

        <style type="text/css">
            .dropdown:hover .menu-top{display:block;}
            .dropdown-submenu{position:relative;}
            .dropdown-submenu > .dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px;}
            .dropdown-submenu:hover > .dropdown-menu{display:block;}
            .dropdown-submenu > a:after{display:block;content:" ";float:right;width:0;height:0;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;border-left-color:#cccccc;margin-top:5px;margin-right:-10px;}
            .dropdown-submenu:hover > a:after{border-left-color:#ffffff;}
            .dropdown-submenu .pull-left{float:none;}
            .dropdown-submenu.pull-left > .dropdown-menu{left:-100%;margin-left:10px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px;}
     a:link{text-decoration:none;}
    a:visited{text-decoration:none;}
    a:active{text-decoration:none;}
      a:hover{text-decoration:none;}
     .nav-head{padding-left:30%;background-color: #393939;border:0px;} 
   .navbar-brand{color:white!important;}
  .navbar{margin-bottom: 0px}
   #w5 a{color:white!important}
   #w2 button{margin-top:34px;float:right}
    .navbar-default .navbar-nav > li > a {
       color: white;
       background-color: transparent;
   }
  .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
      color: #449d44 !important ;
       background-color: black;
   }
   .filename{margin-top:22px;margin-right: 120px;height:30px;padding-top:2px;display:inline-block;width:400px;}
   .container .col-md-12 .col-md-12 { width: 650px;}
   .edit{display:none;font-size: 13px}
   
   .navbar-inverse .navbar-brand{
           color: #9d9d9d !important;
   }
   
   .edit1{ margin-top:-8px;margin-bottom: 3px;display:inline!important;height:20px}
   .nbsp{margin-top:-8px;margin-bottom: 3px;display:inline}
   .nbsp1{margin-top:-8px;margin-bottom: 3px;display:inline}
   .display{display:none}
   .display-inline{display:inline!important;}
   .form-up{width:95%;}
   .dropdown{height:35px;margin-right:0px;}
   .dropdown .dropdown-toggle{margin-left: 10px;}
   .fhead{margin-bottom: 10px;display:flex;margin-top:15px;}
    .img-delete{border-radius: 8px;}
    .delete-red{position: absolute;margin-left: 85px;display:none;border-radius: 8px;}
    
     .footer{background-color: #393939;color:white;height:100px;line-height: 55px;      
        background: -webkit-linear-gradient(#767676, #393939); /* Safari 5.1 - 6.0 */
        background: -o-linear-gradient(#767676, #393939); /* Opera 11.1 - 12.0 */
        background: -moz-linear-gradient(#767676, #393939); /* Firefox 3.6 - 15 */
        background: linear-gradient(#767676, #393939); /* 标准的语法 */
        display:none
    }
    .wrap{padding:0px}
    .form-control{background-color: #FcFcFc;}
    .btn-md{background-color: #FcFcFc;}
    .yii-debug-toolbar__bar{display:none}
    .headname{width:20%;margin-left:20px;}
    .navbar-inverse{background-color: transparent;border:0px}
        </style>

        <?php $this->head() ?>

    </head>
    <body>
        <?php $this->beginBody() ?>

        <div class="wrap">
            <nav class="navbar navbar-inverse ">
            <!--<div >-->
            <?php
            NavBar::begin([
                'brandLabel' => '客服管理系统',
                'brandUrl' => '',
                'options' => [
                    'class' => 'navbar-default navbar-fixed-top nav-head ',
                ],
            ]);
            ?>

            <?php
            if (Yii::$app->authManager->checkAccess(Yii::$app->user->getId(), 'admin')) {
                echo Nav::widget([
                    'options' => ['class' => 'navbar-nav navbar-left'],
                    'items' => [
                        ['label' => '在线客服', 'url' => ['/service/index']],
                        ['label' => '用户管理', 'url' => ['/user/admin/index'],],
                        ['label' => '权限管理', 'url' => ['/rbac/role/index']],
                        ['label' => '渠道管理', 'url' => ['/chat-source/index']],
                        ['label' => '分配渠道', 'url' => ['/chat-assigned/index']],
                        Yii::$app->user->isGuest ?
                                ['label' => '登录', 'url' => ['/user/security/login']] :
                                ['label' => '退出登录 (' . Yii::$app->user->identity->username . ')',
                            'url' => ['/user/security/logout'],
                            'linkOptions' => ['data-method' => 'post']],
                ]]);
                

             } else if(Yii::$app->authManager->checkAccess(Yii::$app->user->getId(), 'user')){ 
                
                echo Nav::widget([
                    'options' => ['class' => 'navbar-nav navbar-left'],
                    'items' => [
                        ['label' => '在线客服', 'url' => ['/service/index']],
                        Yii::$app->user->isGuest ?
                                ['label' => '登录', 'url' => ['/user/security/login']] :
                                ['label' => '退出登录 (' . Yii::$app->user->identity->username . ')',
                            'url' => ['/user/security/logout'],
                            'linkOptions' => ['data-method' => 'post']],
                ]]);
                

            
             
             } else { 
                
                echo Nav::widget([
                    'options' => ['class' => 'navbar-nav navbar-left'],
                    'items' => [
//                        ['label' => '在线客服', 'url' => ['/service/index']],
                        Yii::$app->user->isGuest ?
                                ['label' => '登录', 'url' => ['/user/security/login']] :
                                ['label' => '退出登录 (' . Yii::$app->user->identity->username . ')',
                            'url' => ['/user/security/logout'],
                            'linkOptions' => ['data-method' => 'post']],
                ]]);
             }
            
            NavBar::end();
            ?>
            </nav>
            <div class="container1">
                
                
                <?= $content ?>
            </div>
           

        </div>

        <footer class="footer">
            <div class="container">
                <p class="text-center">Copyright &copy; MASTER <?= date('Y') ?></p>
            </div>
        </footer>

        <?php $this->endBody() ?>
    </body>
</html>
<?php $this->endPage() ?>
